import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.dengke.mybatis.entity.City;
import com.dengke.mybatis.mapper.CityMapper;

public class Application {

	public static void main(String[] args) throws Exception{

		String resource = "SqlMapConfig.xml";

		InputStream inputStream = Resources.getResourceAsStream(resource);
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);

		SqlSession sqlSession = sqlSessionFactory.openSession();

		CityMapper cityDao = sqlSession.getMapper(CityMapper.class);
		City city = cityDao.selectByPrimaryKey(1);
		System.out.println(city.toString());
	}

}
